package net.zjitc.test;

import java.util.Random;

/**
 * 随机点名器
 */
public class RandomCall {
    public static void main(String[] args) {
        String[] yd1901={"朱新舜","万泽豪","卢渊","柳嘉豪","朱善沛","吴焘均","俞文瀚","郭勇杰",
                "阚传龙","林志强","杨校","廖明浙","温正雍","年亚轩","王迎祯","符文杰","廖毕龙",
                "黄慧刚","李求民","徐晨韬","毛建成","卢长安","洪耀荣","周自强","吴俣震","薛成好",
                "潘忠强","饶志刚","张军","于飞扬","胡海洋","杨成明","张乐","金煜凯","叶凯","余斌",
                "高世宇","顾镕泽","孔佳豪"};

        System.out.println("学生名单如下：");
        for(int i=0;i<yd1901.length;i++){
            if(i!=0 && i%5==0){
                System.out.println();
            }
            System.out.print(yd1901[i]+"\t");
        }
        System.out.println();
//      根据数组长度，获取随机索引
        Random ran=new Random();
        int randomIndex=ran.nextInt(yd1901.length);
        String name=yd1901[randomIndex];
        System.out.println("\n随机点到的同学是："+name);
    }
}
